﻿using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;
using Hangfire;
using Hangfire.SqlServer;

namespace SAIM
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
            try
            {
                // HangFire
                GlobalConfiguration.Configuration
                .UseSqlServerStorage(
                    "SAIMHangFire",
                    new SqlServerStorageOptions { QueuePollInterval = TimeSpan.FromSeconds(1) });

                app.UseHangfireDashboard();
                app.UseHangfireServer();
            }
            catch (Exception) { /* Si falla la inicialización de HangFire se continua de forma normal */ };
        }
    }
}
